/*
   Copyright 2010 jcgarciam [at] gmail [dot] com

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Data;
namespace Cruddy.Persistence.Attributes
{

    /// <summary>
    ///  Define a parameter for an StoredProcedure (INSERT/UPDATE), use the underlying database syntax for naming parameters i.e:
    ///  for MSSQLServer use '@' prefix in the attribute 'Name' for your parameter.
    /// </summary>
    [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
    public class SpParamAttribute : Attribute
    {
        private string name;
        private ParameterDirection direction;

        public SpParamAttribute(string name)
        {
            this.Name = name;
            this.Direction = ParameterDirection.Input;
        }
        public ParameterDirection Direction
        {
            get { return direction; }
            set { direction = value; }
        }
        public string Name
        {
            get { return name; }
            set { name = value; }
        }
    }

    /// <summary>
    ///  Define a parameter for an StoredProcedure (DELETE), use the underlying database syntax for naming parameters i.e:
    ///  for MSSQLServer use '@' prefix in the attribute 'Name' for your parameter.
    /// </summary>
    [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
    public class SpParamDeleteAttribute : Attribute
    {
        private string name;

        public string Name
        {
            get { return name; }
            set { name = value; }
        }
    }

    /// <summary>
    ///  Define a parameter for an StoredProcedure (SELECT), use the underlying database syntax for naming parameters i.e:
    ///  for MSSQLServer use '@' prefix in the attribute 'Name' for your parameter.
    /// </summary>
    [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
    public class SpParamSelectAttribute : Attribute
    {
        private string name;
        public string Name
        {
            get { return name; }
            set { name = value; }
        }
    }

 	/// <summary>
    ///   Define a parameter for an StoredProcedure output (SELECT), use the underlying database syntax for naming parameter i.e:
    ///   for MSSQLServer use '@' prefix in the attribute 'Name' for your parameter.
    /// </summary>
    [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
    public class SpColumnResultAttribute : Attribute
    {
        public SpColumnResultAttribute(string colName)
        {
            this.ColumnName = colName;
        }
        private string columnName;

        public string ColumnName
        {
            get { return columnName; }
            set { columnName = value; }
        }
    }
}
